package com.xy.p2p.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.p2p.dao.TfinanceauditDao;
import com.xy.p2p.model.Tfinanceaudit;
import com.xy.p2p.service.TfinanceauditService;

@Service
@Transactional
public class TfinanceauditServiceImpl extends BaseServiceImpl<Tfinanceaudit> implements
		TfinanceauditService {
	private TfinanceauditDao tfinanceauditDao;

	public TfinanceauditServiceImpl(TfinanceauditDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tfinanceauditDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tfinanceauditDao.checkExist("Tfinanceaudit", paraName, paraValue);
	}

	@Override
	public List<Tfinanceaudit> getTfinanceaudit(Map<String, Object> map) {
		return tfinanceauditDao.getTfinanceaudit(map);
	}
	@Override
	public Pagination getTfinanceauditByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tfinanceauditDao.getTfinanceauditByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tfinanceaudit save(Tfinanceaudit tfinanceaudit) {
//		tfinanceaudit.setModtime(new Date());
		if(tfinanceaudit.getFaid()==null){
			//新增
        	return super.save(tfinanceaudit);
		}else{
			//更新
			Tfinanceaudit tfinanceaudit1=tfinanceauditDao.get(tfinanceaudit.getFaid());
			try {
				BeanUtil.copyNotNullProperties(tfinanceaudit1, tfinanceaudit);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tfinanceaudit1);
		}
	}
}